home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1999-11-24 | 7.6 KB | 346 lines |
- G4C
-
- WINBIG 56 47 542 156 'SAS C Programming GUI'
- WinType 11110001
- resinfo 8 640 256
- winout 'NIL:' ; no shell output..
-
- xOnLoad file
- ; assign sc if not assigned..
- ifexists assign ~sc
- ifexists directory hard:prog/sc
- assign sc: hard:prog/sc ; me..
- else
- temp = ''
- reqfile -1 -1 300 -40 'Where is the SC directory?' DIR temp sys:
- if $temp = ''
- guiopen #this
- stop
- endif
- assign sc: $temp
- endif
- assign lib: sc:lib
- assign include: sc:include
- cli 'path sc:c add'
- endif
- setgad #this 91 hide ; hide lv
- GuiOpen #This
-
- xOnReload file
- GuiOpen #This
-
- xOnClose ; quit if running alone..
- ifexists gui ~cedbar.gc
- GuiQuit #This
- endif
-
- xOnQuit
- GuiQuit sc.dcpop
-
- xOnFail
- guiopen #this
- guiscreen #this front
- speak 'Operation failed!'
- lvuse #this 1
- lvadd 'Operation failed.'
-
- ; =======================================================
- ; -- the pipe event where the output is piped at
- ; =======================================================
-
- xPipe pipe:SC_RES ON
- gadid 2
- lvuse #this 1 ; whenever a line is available
- lvadd $$pipe ; append it to our listv
-
- ; =======================================================
- ; Main LV
- ; =======================================================
-
- XLISTVIEW 0 15 540 141 "" item "" 10 MULTI
- gadid 1
- attr resize 0022
- gadfont #mono 8 000
- local name/line/type/tnum
-
- ; parse the line
- cutvar item copy word 4 line
- parsevar line
- name = $$parse.0
- line = $$parse.1
- type = $$parse.2
- tnum = $$parse.3
- if $type == 'Warning'
- or $type == 'Error'
- guiopen sc.dcpop $fpath $name $line $type $tnum
- endif
-
- ; data lv
- XLISTVIEW 0 0 542 156 "" hlv "" 0 DIR
- gadid 91
-
- ; =======================================================
- ; Icons
- ; =======================================================
-
- ; ============================= sc xx genprotos
-
- XICON 0 0 :icons/GenProtos
- attr resize 0000
- if $fname = ''
- gosub #this getfile
- endif
- if $fname > ''
- lvuse #this 1
- lvadd 'Generating protos for $fname '
- ; run 'sc >pipe:SC_RES $fname genprotos'
- launch 1 'sc >pipe:SC_RES $fname genprotos'
- endif
-
- ; ============================= sc xx link
-
- XICON 25 0 :icons/Compile
- attr resize 0000
- if $fname = ''
- gosub #this getfile
- endif
- if $fname > ''
- lvuse #this 1
- lvadd 'Compiling $fname '
- ; run 'sc >pipe:SC_RES $fname link'
- launch 1 'sc >pipe:SC_RES $fname link'
- endif
-
- ; ------ Return from Compile and GenProtos
-
- xOnReturn 1
- guiopen #this
- guiscreen #this front
- speak 'Operation finished!'
- lvuse #this 1
- lvadd 'Operation finished.'
-
- ; ============================= file to compile
-
- XTEXTIN 50 0 88 14 "" fname '' 100
- gadid 3
- attr resize 0000
-
- ; ============================= choose file (will cd to it's dir)
-
- XICON 140 0 :icons/Open
- attr resize 0000
- gosub #this getfile
-
- ; ============================= Open shell on the front screen
-
- XICON 190 0 :icons/Shell
- attr resize 0000
- shell = $$g4c.output ; the default shell type
- extract shell unquote shell
- shell = '\"$shell\/SCREEN $$sys.fsn\"'
- run 'newshell $shell'
-
- ; ============================= Open dir.gc
-
- XICON 215 0 :icons/Dir
- attr resize 0000
- guiclose dir.gc
- guiload guis:dir/dir.gc
- lvuse dir.gc 1
- if $$lv.dir = '' ;
- if $fpath > ''
- lvdir #$fpath
- endif
- endif
-
- ; ============================= Clear LV
-
- XICON 165 0 :icons/Clear
- attr resize 0000
- lvuse #this 1
- lvclear
-
- ; ============================= Get C functions
-
- XICON 240 0 :icons/Functions
- attr resize 0000
- funcfile = ''
- ReqFile -1 -1 300 -40 'Choose C file:' LOAD funcfile $fpath
- if $funcfile > ''
- cli 'getfunc >pipe:SC_RES $funcfile'
- endif
-
- ; ============================= Break sc
-
- XICON 265 0 :icons/Quit
- attr resize 0000
- BreakTask 'sc' C
- lvuse #this 1
- lvadd 'Aborted operation.'
-
- ; =======================================================
- ; Menus
- ; =======================================================
-
- xMenu Project Open.. '' 'O'
- gosub #this getfile
-
- xMenu Project BARLABEL '' ''
-
- xMenu Project 'About..' '' ''
- ezreq 'SC.gc - 1.0 - by dck@hol.gr\n\nA simple gui for the\nSAS C development system' 'OK' ''
-
- xMenu Project 'Quit' 'SC.gc' ''
- guiquit #this
-
- xMenu Project 'Quit' 'CedBar.gc' ''
- guiquit cedbar.gc
-
- xMenu Project 'Quit' 'Gui4Cli (all)' ''
- ezreq 'Quit Gui4Cli ?' 'YES|CANCEL' choice
- if $choice = 1
- quit
- endif
-
- ; ======================= Edit
-
- xMenu Edit 'Clear list' '' 'C'
- lvuse #this 1
- lvclear
-
- xMenu Edit 'Clear Selected' '' ''
- lvuse #this 1
- guiwindow #this wait
- setgad #this 1 HIDE ; hide lv for speed..
- lvmulti first
- while $$lv.line > ''
- lvdel -1
- lvmulti first
- endwhile
- setgad #this 1 SHOW
- guiwindow #this resume
- lvmulti show
-
- xMenu Edit 'Select all' '' 'A'
- lvuse #this 1
- lvmulti all
-
- xMenu Edit 'Un-Select all' '' 'N'
- lvuse #this 1
- lvmulti none
-
- xMenu Edit BARLABEL '' ''
-
- xMenu Edit 'MakeID Selection' '' ''
- ; get selected text
- SendRexx $cedport cut
- lvuse CedClip.g 1
- lvchange 'CLIPS:$cedClip'
- txt = $$lv.rec
- sendrexx $cedport "text #define $txt\tMakeID(\'$txt[0][1]\',\'$txt[1][1]\',\'$txt[2][1]\',\'$txt[3][1]\')\t\t// "
-
- ; =======================================================
- ; Routines
- ; =======================================================
-
- xRoutine GetFile ; get a file
- local dir
- if $fname = ''
- ifexists gui cedbar.gc
- ; get the current filename so we can get it's path
- sendrexx $cedbar.gc/cedport 'status filename'
- dir = $$rexxret
- extract dir path dir
- endif
- endif
- newfile = ''
- reqfile -1 -1 300 -40 'Choose C source file:' LOAD newfile $dir
- if $newfile > ''
- file = $newfile
- extract file ext fext
- if $fext !! '.c'
- ezreq 'Please choose a C file' OK ''
- stop
- endif
- extract file file fname
- extract file path fpath
- cd $fpath
- setwintitle #this 'DIR: $fpath'
- update #this 3 $fname
- endif
-
-
- ; &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- ; ====================================================================
- NewFile sc.dcpop ; pop-up on doubleclick
- ; ====================================================================
- ; &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
-
- WinBig 0 0 80 90 ""
- WinType 00001000
- winonmouse 30 7
-
- ; FullPath FileName LineNumber TypeOfErrorOrWarning Number
- xOnOpen fpath fname lnum type tnum
- joinfile $fpath $fname file
-
- xOnRMB
- guiclose #This
- xOnInactive
- guiclose #This
- xOnFail
- ezreq "Error during operation" OK ""
-
- xBefore ; before every action...
- GuiClose #this
- ; if cedbar is not running, fire it up..
- ifexists gui ~cedbar.gc
- guiload sq1:guis/cedbar/cedbar.gc
- endif
-
- ; ================================================================
- ; Buttons
- ; ================================================================
- ; ======================== Goto error line
-
- xbutton 0 0 0 15 '-> Line'
- guiscreen cedbar.gc front
- sendrexx $cedbar.gc/cedport 'jump to file $file'
- if $$rexxret = 0 ; file not loaded
- sendrexx $cedbar.gc/cedport 'open new'
- sendrexx $cedbar.gc/cedport 'open $file' ; full path..
- endif
- sendrexx $cedbar.gc/cedport 'expand view'
- sendrexx $cedbar.gc/cedport 'jump to line $lnum'
-
- ; ======================== Goto error number (in sc guide)
-
- xbutton 0 15 0 15 '-> Error'
- ; if our amigaguide is not runing, start it
- ifexists port ~SCAGUIDE
- run 'amigaguide sc:help/scmsg.guide screen=$$sys.fsn port=SCAGUIDE'
- wait port SCAGUIDE 30
- if $$retcode > 0
- ezreq "Couldn't find the AmigaGuide\nprogram in your path!" OK ''
- stop
- endif
- endif
- ; make ag node name for error - must be 005 or 112 or 095
- cutvar tnum cut char -1 '' ; cut off the ':'
- err = '000'
- info variable tnum
- len = $$var.length
- c = $(3 - $len)
- err[$c][$len] = $tnum
- sendrexx SCAGUIDE 'LINK sc:help/scmsg.guide/scm$err'
-
- xbutton 0 30 0 15 ''
-
- xbutton 0 45 0 15 ''
-
- xbutton 0 60 0 15 ''
-
- xbutton 0 75 0 15 ''
-
-